<?php

/**
 * This is the model class for table "vent_pipe".
 *
 * The followings are the available columns in table 'vent_pipe':
 * @property integer $id
 * @property integer $no
 * @property integer $size
 * @property string $height
 * @property string $unit_measurement_of_the_height
 * @property string $flame_arrester
 * @property string $weatherhood
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class VentPipe extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return VentPipe the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
const a = "Foot";
const b ="Inches";
public function getMeasurement(){
return array(
self::a=>"Foot",
self::b=>"Inches"
);


}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'vent_pipe';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('no, size, inspection_id', 'numerical', 'integerOnly'=>true),
			array('height', 'length', 'max'=>11),
			array('unit_measurement_of_the_height', 'length', 'max'=>6),
			array('flame_arrester, weatherhood', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, no, size, height, unit_measurement_of_the_height, flame_arrester, weatherhood, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'no' => 'No',
			'size' => 'Size',
			'height' => 'Height',
			'unit_measurement_of_the_height' => 'Unit Measurement Of The Height',
			'flame_arrester' => 'Flame Arrester',
			'weatherhood' => 'Weatherhood',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('no',$this->no);
		$criteria->compare('size',$this->size);
		$criteria->compare('height',$this->height,true);
		$criteria->compare('unit_measurement_of_the_height',$this->unit_measurement_of_the_height,true);
		$criteria->compare('flame_arrester',$this->flame_arrester,true);
		$criteria->compare('weatherhood',$this->weatherhood,true);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}